package com.xcalendar.managementImpl;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.xcalendar.database.dao.LocationDAO;
import com.xcalendar.database.table.Event;
import com.xcalendar.database.table.Location;
import com.xcalendar.database.table.User;
import com.xcalendar.management.LocationManager;

public class LocationManagerImpl implements LocationManager {

	@Override
	public Location addLocation(User user, Location location) {
		Key k = KeyFactory.createKey(User.class.getSimpleName(), user.getUserName());
		location.setUserKey(k);
		LocationDAO locationDAO = new LocationDAO();
		locationDAO.addLocation(location);
		return location;
	}

	@Override
	public void delateLocation(String locationId) {
		LocationDAO locationDAO = new LocationDAO();
		locationDAO.deleteLocation(KeyFactory.stringToKey(locationId));
	}

	@Override
	public Location updateLocation(Location location) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Location addLocationToEvent(Event event, Location location) {
		
		return null;
	}

}
